using System.Data.Common;
using SBPweb.Data.Generic;

#if SQL2005
using System.Data.SqlClient;

namespace SBPweb.Data.SQL2005
{

	/// <summary>
	/// This class handles the object polymorphism for generic SqlRepositories
	/// </summary>
	/// <typeparam name="TDomainObject">Domain object of SqlRepository</typeparam>
	public class SqlRepositoryWrapper<TDomainObject> : SqlRepository<Entity> where TDomainObject : Entity
	{

		private SqlRepository<TDomainObject> mRepository;

		/// <summary>
		/// Creates a new instance of SqlRepositoryWrapper
		/// </summary>
		/// <param name="repository">SqlRepository&lt;TDomainObject&gt; that wrapped by this instance</param>
		public SqlRepositoryWrapper(SqlRepository<TDomainObject> repository)
		{
			mRepository = repository;
		}

		#region SqlRepository<Entity> Members

		/// <summary>
		/// SqlDatabase of repository
		/// </summary>
		public override SqlDatabase DB
		{
			get 
			{ 
				return mRepository.DB; 
			}
			set 
			{ 
				mRepository.DB = value; 
			}
		}

		/// <summary>
		/// SqlTransaction of repository
		/// </summary>
		public override SqlTransaction Transaction
		{
			get 
			{ 
				return mRepository.Transaction; 
			}
			set 
			{ 
				mRepository.Transaction = value; 
			}
		}

		/// <summary>
		/// Connection string of repository
		/// </summary>
		public override string DatabaseConnectionString
		{
			get 
			{ 
				return mRepository.DatabaseConnectionString; 
			}
			set 
			{ 
				mRepository.DatabaseConnectionString = value; 
			}
		}

		/// <summary>
		/// SqlConnectionProvider of repository
		/// </summary>
		public override SqlConnectionProvider Provider
		{
			get 
			{
				return mRepository.Provider;
			}
			set
			{
				mRepository.Provider = value;
			}
		}

		#endregion
	}
}
#endif